FORTHS := gforth pforth iforth swiftforth vfxforth win32forth

.PHONY: all check check-gforth check-pforth check-vfxforth clean

all:
	gforth bootstrap/gforth.fs -e 's" demand" make-load-files bye'

check: check-gforth check-pforth check-vfxforth

check-gforth:
	cp bootstrap/gforth.fs .
	gforth gforth.fs -e 's" demand" s" gforth.fs" make-load-file bye'
	cp gforth.fs gforth.fs~
	gforth gforth.fs -e 's" demand" s" gforth.fs" make-load-file bye'
	cmp gforth.fs~ gforth.fs
	rm gforth.fs gforth.fs~

check-pforth:
	echo 'include pforth.fs :noname s" demand" ; execute :noname s" pforth.fs" ; execute make-load-file' > pforth-make.fs
	cp bootstrap/pforth.fs . && pforth -q pforth-make.fs >pforth.log
	cp pforth.fs pforth.fs~ && pforth -q pforth-make.fs >>pforth.log
	rm pforth-make.fs
	cmp pforth.fs~ pforth.fs
	rm pforth.fs pforth.fs~ pforth.log

check-vfxforth:
	cp bootstrap/vfxforth.fs .
	vfxlin 'include vfxforth.fs :noname s" demand" ; execute :noname s" vfxforth.fs" ; execute make-load-file bye' >vfxforth.log
	cp vfxforth.fs vfxforth.fs~
	vfxlin 'include vfxforth.fs :noname s" demand" ; execute :noname s" vfxforth.fs" ; execute make-load-file bye' >>vfxforth.log
	cmp vfxforth.fs~ vfxforth.fs
	rm vfxforth.fs vfxforth.fs~ vfxforth.log


clean:
	rm -f $(FORTHS:%=%.fs) $(FORTHS:%=%.fs~)
